﻿@model SiteConfigEditGetViewModel
@{
    ViewBag.Title = "网站配置";
}

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 网站配置 <a class="btn btn-success radius r btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:;" onclick="javascript: location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="page-container">
    <form class="form form-horizontal" id="form">
        <div id="tab-system" class="HuiTab">
            <div class="tabBar cl">
                <span>基本设置</span>
                <span>首页设置</span>
                <span>其他设置</span>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>网站名称：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.SiteName" placeholder="" id="sitename" name="sitename">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">网站网址：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.SiteUrl" placeholder="" id="siteurl" name="siteurl">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">（SEO）关键字：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.Keywords" placeholder="一般不超过100个字符" id="keywords" name="keywords">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">（SEO）描述：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <textarea class="textarea" placeholder="一般不超过200个字符" id="description" name="description">@Model.SiteConfig.Description</textarea>
                    </div>
                </div>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">首页banner：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("homebanner", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.Homebanner), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">首页最新通知：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("homeNotice", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.HomeNotice), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">首页书院要闻：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("homeNews", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.HomeNews), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">首页书院简介：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("homeAbout", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.HomeAbout), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">首页学在明德：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("homeStudy", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.HomeStudy), new { @class = "select" })
                        </span>
                    </div>
                </div>
            </div>
            <div class="tabCon">
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">头部链接：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("headerlinks", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.Headerlinks), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">底部链接：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <span class="select-box" style="width:150px;">
                            @Html.DropDownList("footerlinks", new SelectList(Model.ListSiteNav, "Value", "Text", Model.SiteConfig.Footerlinks), new { @class = "select" })
                        </span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">地址：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.Address" placeholder="" id="address" name="address">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">联系电话：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.Tel" placeholder="" id="tel" name="tel">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">邮箱：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.Email" placeholder="" id="email" name="email">
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">版权：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" class="input-text" value="@Model.SiteConfig.Copyright" placeholder="" id="copyright" name="copyright">
                    </div>
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button type="submit" class="btn btn-primary radius" id="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
            </div>
        </div>
    </form>
</div>

@section FooterScript
{
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="~/Areas/WebAdmin/FrontLib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="~/Areas/WebAdmin/FrontLib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="~/Areas/WebAdmin/FrontLib/jquery.validation/1.14.0/messages_zh.js"></script>

    <script type="text/javascript">
        $(function () {
            $("#tab-system").Huitab({
                index: 0
            });

            $("#form").validate({
                rules: {
                    sitename: {
                        required: true
                    }
                },
                onkeyup: false,
                focusCleanup: true,
                success: "valid",
                submitHandler: function (form) {
                    //禁用保存按钮，防止重复提交
                    $("#submit").prop("disabled", true);

                    $(form).ajaxSubmit({
                        type: 'POST',
                        url: "/WebAdmin/SiteConfig/Edit",
                        success: function (res) {
                            if (res.status == "ok") {
                                parent.layer.msg('修改成功!', { icon: 1, time: 1000 }, function () {
                                    location.reload(); //刷新页面
                                });
                            } else if (res.status == "redirect") {
                                location.href = res.data;
                            } else if (res.status == "error") {
                                layer.msg(res.errorMsg, { icon: 2, time: 1000 });
                                //解除禁用
                                $("#submit").prop("disabled", false);
                            } else {
                                layer.msg("修改失败", { icon: 2, time: 1000 });
                                //解除禁用
                                $("#submit").prop("disabled", false);
                            }
                        },
                        error: function (XmlHttpRequest, textStatus, errorThrown) {
                            layer.msg('网络出错!', { icon: 2, time: 1000 });
                        }
                    });
                }
            });
        });
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
}
